#!/usr/bin/env python
# coding=utf-8
"""
# @Created on : 2016/04/23 16:27
# @Author     : ldf (ldf@eehello.com)
# @Link       : http://www.eehello.com
# @Version    : 
# 本程序在python2.7下测试通过
"""

'''
def run(kahao):
    print('转账')
'''

import pickle

def run(kahao):
    flag = 1
    while flag:
        with open('backgroud/ka_mon', 'rb') as fm:
            ka_mon_l = pickle.load(fm)
            ka_mon = ka_mon_l[kahao]
        print("您目前的额度为：%s' , 返回，请按'q' " % ka_mon)
        print('如需转账，请在下面输入对方账号及金额：')
        z_ka = raw_input("请输入对方账号(按'q'返回)：")
        if z_ka == 'q':
            flag = 0
            break

        z_mon = input('请输入要转账的金额：')

        if z_mon <= ka_mon:
            ka_mon -= z_mon
            ka_mon_l[kahao] = ka_mon
            try:
                ka_mon_l[z_ka] += z_mon
            except Exception,e:
                print('转账失败')
                break
            with open('backgroud/ka_mon', 'wb') as fw:
                pickle.dump(ka_mon_l, fw)



